app.controller('loginCtrl',['$scope','$rootScope','$http','$state','cookies','listSve',function($scope,$rootScope,$http,$state,cookies,listSve){
	
	$scope.init = function(){
		$scope._uid = '';
		$scope._upw = '';
	};
	$scope.init();
	
	$scope.loginIn = function(){
		
		var loginId = $scope._uid;
		var loginPw = $scope._upw;
		
		if(loginId == ''){
			alert("帐号不能为空!");
			return;
		};
		if(loginPw == ''){
			alert("密码不能为空");
			return;
		}
		
		listSve.loginList().delete({loginName:loginId,loginPwd:loginPw}).then(function(data) {
			console.log(data)
          	if(data.status == 0){
				
				//$rootScope.setCookie('userName',loginId);
				cookies.setCookie('userName',loginId);
				//$state.go('main.eamic'); //跳转到设备管理
				$state.go('main.riskManagement');  //暂时跳转到风控
				
			} else{
				
				//alert(data.info);
				$scope.alert({show: true, Title:'系统提示', Message:data.info, prevId:'',Type:false});
				
			}
            
	            
        });
		
	};
	
}])


//.success(function(data){
//			console.log("----");
//			console.log(data);
//		}).error(function(err){
//			console.log(err);
//		})